home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / wschesb1.zip / SRC / INIT.C < prev    next >
C/C++ Source or Header  |  1994-03-15  |  4KB  |  107 lines

  1. /*
  2.   C source for Winsock Chess
  3.   
  4.   Revision 1994-03-15
  5.   Modified by Donald Munro for use as a 2 player chess game over a 
  6.   WINSOCK layer on a TCP (or other WinSock supporting) network.
  7.   Source code and make files for MS Visual C/C++ V1.00/1.50.
  8.   February/March 1994
  9.   All GNU copyright and distribution conditions as described below and in the
  10.   file COPYING also apply to WinSock Chess.
  11.   This module is adapted from GNU Chess. 
  12.   
  13.   
  14.   C source for GNU CHESS
  15.  
  16.   Revision: 1990-09-30
  17.  
  18.   Modified by Daryl Baker for use in MS WINDOWS environment
  19.  
  20.   This file is part of CHESS.
  21.  
  22.   Modified by Donald Munro for use as a 2 player chess game over a 
  23.   communications link viz WINSOCK or other.
  24.   Source code and make files for MS Visual C++ V1.00/1.50
  25.   Conversion to usage of message crackers for easy conversion to win32
  26.   February/March 1994
  27.  
  28.   CHESS is distributed in the hope that it will be useful, but WITHOUT ANY
  29.   WARRANTY.  No author or distributor accepts responsibility to anyone for
  30.   the consequences of using it or for whether it serves any particular
  31.   purpose or works at all, unless he says so in writing.  Refer to the CHESS
  32.   General Public License for full details.
  33.  
  34.   Everyone is granted permission to copy, modify and redistribute CHESS, but
  35.   only under the conditions described in the CHESS General Public License.
  36.   A copy of this license is supposed to have been given to you along with
  37.   CHESS so you can know your rights and responsibilities.  It should be in a
  38.   file named COPYING.  Among other things, the copyright notice and this
  39.   notice must be preserved on all copies.
  40. */
  41.  
  42. #define NOATOM 
  43. #define NOCLIPBOARD
  44. #define NOCREATESTRUCT
  45. #define NOFONT
  46. #define NOREGION
  47. #define NOSOUND
  48. #define NOWH
  49. #define NOCOMM
  50. #define NOKANJI
  51.  
  52. #include <windows.h>
  53.  
  54. extern char szAppName[];
  55.  
  56. LRESULT CALLBACK ChessWndProc(HWND hWnd, UINT message,
  57.                              WPARAM wParam, LPARAM lParam);
  58. LRESULT CALLBACK StatusBarProc(HWND,UINT,WPARAM,LPARAM);                             
  59.  
  60. extern DWORD clrBackGround;
  61. extern DWORD clrBlackSquare;
  62. extern DWORD clrWhiteSquare;
  63. extern DWORD clrBlackPiece;
  64. extern DWORD clrWhitePiece;
  65.  
  66. BOOL FAR ChessInit(HANDLE hInstance)
  67. {
  68.     HANDLE hMemory;                /* handle to allocated memory */
  69.     PWNDCLASS pWndClass;               /* structure pointer      */
  70.     BOOL bSuccess;                 /* RegisterClass() result     */
  71.     WNDCLASS wc;
  72.     HBRUSH hbrushLGrey = CreateSolidBrush(RGB(0XC0,0XC0,0XC0));;
  73.  
  74.     hMemory = LocalAlloc(LHND, sizeof(WNDCLASS));
  75.     pWndClass = (PWNDCLASS) LocalLock(hMemory);
  76.  
  77.     pWndClass->style = NULL;
  78.     pWndClass->lpfnWndProc = ChessWndProc;
  79.     pWndClass->hInstance = hInstance;
  80.     pWndClass->hIcon = LoadIcon(hInstance, szAppName);
  81.     pWndClass->hCursor = LoadCursor(NULL, IDC_ARROW);
  82.     pWndClass->hbrBackground = GetStockObject(WHITE_BRUSH);
  83.     pWndClass->lpszMenuName = (LPSTR) szAppName;
  84.     pWndClass->lpszClassName = (LPSTR) szAppName;
  85.  
  86.     bSuccess = RegisterClass(pWndClass);
  87.     
  88.   wc.style         = CS_HREDRAW | CS_VREDRAW;
  89.   wc.lpfnWndProc   = StatusBarProc;
  90.   wc.cbClsExtra    = 0;
  91.   wc.cbWndExtra    = 0;  
  92.   wc.hInstance     = hInstance;
  93.   wc.hIcon         = NULL;
  94.   wc.hCursor       = LoadCursor(NULL,IDC_ARROW);
  95.   wc.hbrBackground = hbrushLGrey;
  96.   wc.lpszMenuName  = NULL;
  97.   wc.lpszClassName = "STATBR";
  98.   bSuccess = bSuccess & RegisterClass(&wc);
  99.  
  100.     LocalUnlock(hMemory);            
  101.     LocalFree(hMemory);             
  102.  
  103.     return (bSuccess);   
  104. }
  105.  
  106.  
  107.